import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';

class QGOpenBoxRecordItem extends StatefulWidget {
  dynamic data;
  QGOpenBoxRecordItem({super.key, this.data});

  @override
  State<QGOpenBoxRecordItem> createState() => _QGOpenBoxRecordItemState();
}

class _QGOpenBoxRecordItemState extends State<QGOpenBoxRecordItem> {
  @override
  Widget build(BuildContext context) {
    var name = "${widget.data["nickname"]}";

    if (name.length > 1) {
      name = name.replaceRange(0, name.length - 1, "***");
    }

    return Container(
      margin: EdgeInsets.only(bottom: 10.rpx, left: 10.rpx, right: 10.rpx),
      decoration: BoxDecoration(
          color: Color(0xffffffff), borderRadius: BorderRadius.circular(6.rpx)),
      padding: EdgeInsets.all(15.rpx),
      child: Column(children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(
              name,
              style: TextStyle(
                  color: Color(0xFF111111),
                  fontSize: 14.rpx,
                  fontWeight: FontWeight.normal),
            ),
            Text(
              widget.data["goods_name"] ?? "",
              style: TextStyle(
                  color: Color(0xFF111111),
                  fontSize: 12.rpx,
                  fontWeight: FontWeight.normal),
            ),
          ],
        ),
        SizedBox(height: 12.rpx),
        Row(
          children: [
            Text(
              widget.data["created"] ?? "",
              style: TextStyle(
                  color: Color.fromRGBO(17, 17, 17, 0.4),
                  fontSize: 11.rpx,
                  fontWeight: FontWeight.normal),
            ),
          ],
        ),
      ]),
    );
  }
}
